Exactly how you implement each of the properties and methods in the CRDDataSource interface depends upon the purpose and design of your application or component. To give you an idea of how to implement the procedures, though, the following code sample simply uses an ADO Recordset object connected to the Xtreme sample data DataSource. Obviously, this example has little value in a real application; an ADO Recordset can itself be reported on through the Active Data Driver. However, the example does illustrate how the properties and methods in the Crystal Data Source interface work.
Implements CRDataSourceLib.CRDataSource
Dim adoRs As ADOR.Recordset Private Sub Class_Initialize()
Set adoRs = New ADOR.Recordset
adoRs.Open "Customer", "Xtreme sample data", _
adOpenKeyset, adLockOptimistic, adCmdTable
End Sub Private Sub Class_Terminate()
adoRs.Close
Set adoRs = Nothing
End Sub Public Property Let CRDataSource_Bookmark(ByVal RHS As Variant)
adoRs.Bookmark = RHS
End Property Public Property Get CRDataSource_Bookmark() As Variant
CRDataSource_Bookmark = adoRs.Bookmark
End Property Public Property Get CRDataSource_EOF() As Boolean
CRDataSource_EOF = adoRs.EOF
End Property Public Property Get CRDataSource_FieldCount() As Integer
CRDataSource_FieldCount = adoRs.Fields.Count
End Property Public Property Get CRDataSource_FieldName _
(ByVal FieldIndex As Integer) As String
CRDataSource_FieldName = adoRs.Fields(FieldIndex).Name
End Property Public Property Get CRDataSource_FieldType _
(ByVal FieldIndex As Integer) As Integer
CRDataSource_FieldType = adoRs.Fields(FieldIndex).Type
End Property Public Property Get CRDataSource_FieldValue _
(ByVal FieldIndex As Integer) As Variant
CRDataSource_FieldValue = adoRs.Fields(FieldIndex).Value
End Property Public Sub CRDataSource_MoveFirst()
adoRs.MoveFirst
End Sub Public Sub CRDataSource_MoveNext()
adoRs.MoveNext
End Sub Private Property Get CRDataSource_RecordCount() As Long
CRDataSource_RecordCount = adoRs.RecordCount
End Property
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |